package cate.game.pvp.eliterace.data;

import cate.game.util.GameKit;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.data.annotation.Id;

@Data
public class EliteRaceRankRwd {

    @Id
    private String id = GameKit.uid();

    private String uid;
    private int season;
    private int srvId;
    private int rank;
    private String reward;

    public static EliteRaceRankRwd of(String uid, int season, int srvId, int rank, String reward) {
        EliteRaceRankRwd rankRwd = new EliteRaceRankRwd();
        rankRwd.setUid(uid);
        rankRwd.setSeason(season);
        rankRwd.setSrvId(srvId);
        rankRwd.setRank(rank);
        rankRwd.setReward(reward);
        return rankRwd;
    }


    @JsonIgnore
    public String getSrvIdIndexName() {
        return String.format("%d-%d", season, srvId);
    }

    @JsonIgnore
    public String getIndexedKey() {
        return String.format("%s-%d-%d", uid, season, srvId);
    }
}
